<template>
  <div class="ff">
    <Popup :popupVisible="true" :back="back" :source="this.$store.state.user">
      <div class="img">
        <img src="../assets/img/user/user1.jpg" alt="" />
      </div>
      <div class="d1">
        <span class="s1">猴哥</span>
      </div>
      <span class="s2">花果山水帘洞齐天大圣</span>
      <div class="d2">
        <mt-button class="btn2" @click="linkPrivateChat">私聊</mt-button>
        <mt-button class="btn3" @click="collectUser">{{collect}}</mt-button>
      </div>
    </Popup>
  </div>
</template>
<script>
import Popup from "../components/Popup.vue";
export default {
  methods: {
    collectUser(){
      if(this.collect=="关注"){
        
      this.collect = "已关注"
      } else {
        this.collect = "关注"
      }
    },
    linkPrivateChat() {
      this.$router.push({
        name: "WebSocketTest",
        params: { parent: "usercenter" },
      });
    },
    // usercen(){
      
    // }
  },
  data() {
    return {
      collect:"关注",
      back: "user",
      user:'个人主页'
    };
  },
  components: {
    Popup,
  },
  mounted() {
    if (this.$route.params.parent) {
      this.back = this.$route.params.parent;
    }
    this.$store.commit("saveUser",this.user)
  },
};
</script>
<style>
.ff {
  width: 375px;
  height: 601px;
  position: relative;
}
.ff .d1 {
  width: 100%;
  height: 210px;
  border-bottom: 1px solid #000;
  position: relative;
  background-image: url("../assets/img/swipe/xyj.jpg");
  background-size:  cover ;
  background-position: 15px 28px ;
  

}


.ff .img > img {
  width: 80px;
  height: 80px;
  border-radius: 50%;
  position: absolute;
  top: 160px;
  left: 32px;
  z-index: 100;
  
  box-shadow: 1px 1px 9px 0px ;
}
.ff .d1 .s1 {
  font-size: 20px;
  position: absolute;
  top: 170px;
  left: 127px;
  /* color: rgb(252, 246, 246); */
}
.ff .s2 {
  font-size: 13px;
  margin-left: 120px;
  margin-top: 8px;
}
.ff .d2 {
  /* background-color: rgb(223, 19, 19); */
  width: 90%;
  height: 3rem;
  display: flex;
  position: absolute;
  bottom: 1rem;
  left: 1.5rem;
}
.ff .d2 .btn2 {
  width: 150px;
  height: 45px;
  position: absolute;
  background-color: #0f6957;
  color: #000;
  right: 1px;
  color: rgb(240, 232, 232);
}
.ff .d2 .btn3 {
  width: 150px;
  height: 45px;
  position: absolute;
  background-color: #f15a22;
  color: #000;
  left: 1px;
  color: #fcfcf9;
}
</style>